package test;

import static org.junit.Assert.fail;

import java.util.List;
import library.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;

import junit.framework.TestCase;

import org.openqa.selenium.*;
import org.openqa.selenium.support.ui.Select;

/**
 * 
 * SuiteSignUp.java
 * Purpose: Calls te Library Function to execute.
 *
 * @author Vishal Sangave
 * @version 1.0 29 May 2012
 */
@SuppressWarnings("unused")
public class SuiteSignUp{
	
	private WebDriver driver;
	private String baseUrl, url,e;
	private StringBuffer verificationErrors = new StringBuffer();
	
	@Before
	public void setUp() throws Exception {
		driver = new FirefoxDriver();
		baseUrl = "http://www.mgstaging.com/";
		driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
		url = baseUrl+"mglive-59/login";
		System.out.println("\nCompleted Setup");
	}
	@Test
	public void testVerifyLoginArea() throws Exception{
        // The Firefox driver supports javascript 
		System.out.println("\n In Function Test");
	   LibrarySignUp obj = new LibrarySignUp();
	   obj.VerifyLoginArea(driver,url);
	   System.out.println("\n Completed Functional Test");
     }
	
	@Test
	public void testValidLogin() throws Exception{
        // The Firefox driver supports javascript 
		System.out.println("\n In Function Test");
	   LibrarySignUp obj = new LibrarySignUp();
	   obj.ValidLogin(driver,url);
	   System.out.println("\n Completed Functional Test");
	 
     }
	
	@Test
	public void testInvalidLogin() throws Exception{
        // The Firefox driver supports javascript 
		System.out.println("\n In Function Test");
	   LibrarySignUp obj = new LibrarySignUp();
	   obj.InvalidLogin(driver,url);
	   System.out.println("\n Completed Functional Test");
	 
     }
	
	
	@Test
	public void testEmailAddressValidation() throws Exception{
        // The Firefox driver supports javascript 
		System.out.println("\n In Function Test");
	   LibrarySignUp obj = new LibrarySignUp();
	   obj.EmailAddressValidation(driver,url);
	   System.out.println("\n Completed Functional Test");
	 
     }
	
	@Test
	public void testEmailCaseSensitive() throws Exception{
        // The Firefox driver supports javascript 
		System.out.println("\n In Function Test");
	   LibrarySignUp obj = new LibrarySignUp();
	   obj.EmailCaseSensitive(driver,url);
	   System.out.println("\n Completed Functional Test");
	 
     }
	
	@Test
	public void testPasswordCaseSensitive() throws Exception{
        // The Firefox driver supports javascript 
		System.out.println("\n In Function Test");
	   LibrarySignUp obj = new LibrarySignUp();
	   obj.PasswordCaseSensitive(driver,url);
	   System.out.println("\n Completed Functional Test");
     }
	
	@Test
	public void testForgotPassword() throws Exception{
        // The Firefox driver supports javascript 
		System.out.println("\n In Function Test");
	   LibrarySignUp obj = new LibrarySignUp();
	   obj.ForgotPassword(driver,url);
	   System.out.println("\n Completed Functional Test");
     }
	
	@Test
	public void testEmailValidationforFPPage() throws Exception{
        // The Firefox driver supports javascript 
		System.out.println("\n In Function Test");
	   LibrarySignUp obj = new LibrarySignUp();
	   obj.EmailValidationforFPPage(driver,url);
	   System.out.println("\n Completed Functional Test");
     }
	
	@Test
	public void testVerifySignup() throws Exception{
        // The Firefox driver supports javascript 
		System.out.println("\n In Function Test");
	   LibrarySignUp obj = new LibrarySignUp();
	   obj.VerifySignup(driver,url);
	   System.out.println("\n Completed Functional Test");
     }
	
	@Test
	public void testValidateSignup() throws Exception{
        // The Firefox driver supports javascript 
		System.out.println("\n In Function Test");
	   LibrarySignUp obj = new LibrarySignUp();
	   obj.ValidateSignup(driver,url);
	   System.out.println("\n Completed Functional Test");
     }
	
	@After
	public void tearDown() throws Exception {
			driver.quit();
			String verificationErrorString = verificationErrors.toString();
			if (!"".equals(verificationErrorString)) {
				fail(verificationErrorString);
			}
		}
}